
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class C1_11_7 {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        Long[] nums = new Long[n];
        String[] numStrs = br.readLine().split(" ");
        for (int i = 0; i < n; i++) {
            nums[i] = Long.parseLong(numStrs[i]);
        }
        long sum = Long.parseLong(br.readLine());
        Arrays.sort(nums);
        long out1 = -1;
        long out2 = -1;
        for (int i = 0; i < n; i++) {
            if (nums[i] >= sum) {
                break;
            }
            long tmp = sum - nums[i];
            int left = i + 1;
            int right = n - 1;
            int index = -1;
            while (left <= right) {
                int mid = (left + right) >> 1;
                if (nums[mid] > tmp)
                    right = mid - 1;
                else if (nums[mid] < tmp)
                    left = mid + 1;
                else {
                    index = mid;
                    break;
                }
            }
            if (index != -1) {
                out1 = nums[i];
                out2 = nums[index];
                break;
            }
        }
        if (out1 == -1) {
            System.out.println("No");
        } else {
            System.out.println(out1 + " " + out2);
        }
    }
}
